			var $form = $("#turnoverRatioJdrStatistic_Form");
			
			$(document).ready(function (){
				var $form_div = $("#turnoverRatioJdrStatistic_Form div");
				winResize($form_div);
				$(window).resize(function(){//当调整浏览器窗口的大小时，发生 resize 事件
					winResize($form_div);
				});
				loadTable();
//				echarts();
			});
			function initTableTitle(){
				var name = $("#organ").val();
				return name;
			}
			function  loadTable()
			{	
				var name = initTableTitle();
				$('#turnoverRatioJdrStatistic_datagrid').datagrid({
					cls: "theme-datagrid",
					title:name,
					  singleSelect:true,  
					  rownumbers: true,
					  fitColumns:true,
//					  toolbar: '#intotb',
					  collapsible: true,
					  url: "turnoverRatioJdrStatistic/getTurnoverRatioJdr",
					  queryParams: sy.serializeObject($form),
//					  pagination: true,
//					  pageSize: 10,
					  method: 'post'
//					  remoteSort:false,
//					  multiSort:true
				});
			}
			
			function  searchFrom()
			{
				loadTable();
			}
			function  customerInfo_xls()
			{	
				var startTime=$("#startTime").val();
				var endTime=$('#endTime').val();
				var organIds=$('#organIds').val();
				
				var url = cxt+"/turnoverRatioJdrStatistic/excel?startTime=" + startTime + "&endTime=" + endTime+"&organIds="+organIds;
				window.location.href = url;
			}
			function  lookReasonInfo(jdrids,organIds)
			{
				var  startTime = $('#startTime').val();
				var  endTime = $('#endTime').val();
				loadViewDialog('查看顾客成交率（接待人）详细信息', cxt+'/turnoverRatioJdrStatistic/tolookReasonInfo?jdrids='+jdrids+"&organIds="+organIds+
						"&startTime="+startTime+"&endTime="+endTime);
			}
			function  lookReasonratio(jdrids,organIds)
			{	
				$('#reasonratio_window').window('open');
				var  startTime = $('#startTime').val();
				var  endTime = $('#endTime').val();
				var dataName=[];
				var url='/turnoverRatioJdrStatistic/getReasonRatio';
				var data={"jdrids":jdrids,"organIds":organIds,"startTime":startTime,"endTime":endTime};
				var reData = common_ajax.ajaxFunc(url,data,"json");
				for(var i=0;i<reData.length;i++)
				{
					dataName.push(reData[i].name);
				}
				
				echarts(dataName,reData);
			}
			function  echarts(dataName,data)
			{
					/*疗程占比饼状图*/
					require.config({
				        paths: {
				            echarts: 'http://echarts.baidu.com/build/dist'
				        }
				    });
				     require(
				    [
				        'echarts',
				        'echarts/chart/pie',
				        'echarts/chart/bar',
				        'echarts/chart/funnel',
				        'echarts/chart/line'
				    ],
				    function (ec) {
				        var myChart = ec.init(document.getElementById('reasonratio_echarts')); 
				        option = {
				        	    title : {
				        	        text: '疗程占比',
				        	        x:'center'
				        	    },
				        	    tooltip : {
				        	        trigger: 'item',
				        	        formatter: "{a} <br/>{b} : {c} ({d}%)"
				        	    },
				        	    legend: {
				        	        orient : 'vertical',
				        	        x : 'left',
				        	        data:dataName
				        	    },
				        	    toolbox: {
				        	        show : true,
				        	        feature : {
				        	            dataView : {show: true, readOnly: false},
				        	            magicType : {
				        	                show: true, 
				        	                type: ['pie', 'funnel'],
				        	                option: {
				        	                    funnel: {
				        	                        x: '30%',
				        	                        width: '10%',
				        	                        funnelAlign: 'left',
				        	                        max: 1548
				        	                    }
				        	                }
				        	            }
				        	        }
				        	    },
				        	    calculable : true,
				        	    series : [
				        	        {
				        	            name:'访问来源',
				        	            type:'pie',
				        	            radius : '55%',
				        	            center: ['50%', '60%'],
				        	            data:data
				        	        }	        	 
				        	    ]
				        	}
				        myChart.setOption(option); 
				        window.onresize = myChart.resize;
				    }
				);
			}
			